package com.holyant.goods.enums;

public enum CustomerChannelEnum {
    B2B(10, "B2B(含O2O)"),
    C2P(20, "C2P"),
    KA(30, "KA"),
    POP(40, "POP");

    private final Integer code;
    private final String name;

    CustomerChannelEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {

        return name;
    }

    public static String getNameByCode(Integer code) {
        for (CustomerChannelEnum item : CustomerChannelEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getName();
            }
        }
        return "";
    }

    public static Integer getCodeByName(String name) {
        for (CustomerChannelEnum item : CustomerChannelEnum.values()) {
            if (item.getName().equals(name)) {
                return item.code;
            }
        }
        return null;
    }
}
